package com.els.search.service.imlp;

import com.els.search.entity.Goods;
import com.els.search.mapper.GoodsMapper;
import com.els.search.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.Date;
import java.util.Random;

/**
 * @title: FakeNewsServiceImpl
 * @projectName fake-baidu
 * @Date: 2021/7/12 12:43
 * @Author: lei.yu-esint
 * @Description:
 */
@Service
public class GoodsServiceImpl implements GoodsService {

    @Autowired(required = false)
    private GoodsMapper goodsMapper;

    @Override
    public Goods addData() {
        Date date=new Date();
        Goods goods=new Goods();
        goods.setName("海绵宝宝玩偶");
        goods.setInc("+++++++++++");
        goods.setAddtime(new Timestamp(date.getTime()));
        goods.setPrice((int)(1+Math.random()*(10-1+1)));//随机
        goodsMapper.insert(goods);
        return goods;
    }
}
